<!DOCTYPE html>
<html>

<head lang="en">
    <title>结伴而行</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/strategy.css"/>
    <script src="/js/common.js"></script>
    <script src="/js/checkLogin.js"></script>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css">
    <script src="/js/plugins/dialog2/dialog.min.js"></script>


    <link rel="stylesheet" href="/js/commodity/More.css">
    <link rel="stylesheet" href="/js/commodity/style.css"/>
    <link rel="stylesheet" href="/js/commodity/Up.css">
    <script type="text/javascript" src="/js/commodity/touch.js"></script>
    <script type="text/javascript" src="/js/commodity/srcolltop.js"></script>
    <script type="text/javascript" src="/js/commodity/timer.js"></script>
    <script type="text/javascript" src="/js/commodity/xlmenu.js"></script>
    <script src="/js/common.js"></script>
    <script>
        var currentPage = 1;//当前页
        var totalPage;//总页数
        var togetherArr = [];//存放页面的容器
        var loading = false;//判定请求数据是否传完的标记


        function query() {
            if (loading) {//如果是加载状态就不发送请求
                return;
            }
            loading = true;//进入加载状态
            $.get(baseUrl + "/togethers", {currentPage: currentPage, pageSize: 6}, function (data) {
                //每次查询都要把页面信息合并到容器中
                $.merge(togetherArr, data.list);
                var json = {list: togetherArr};
                $(".togethers").renderValues(json, {
                    'getHref': getHref
                });
                $("#title").click(function () {
                    changeClass($(this),"aa","")
                })
                //没查询一次当前页数加1
                currentPage++;
                //获取数据的总页数
                totalPage = data.pages;
                loading = false;//加载完成后把状态改成可以发送请求的状态
            });

        }

        $(function () {
            //默认自动查询第一页数据
            query();
            $(window).scroll(function () {
                //如果页面的滚动长度加窗口长度等于页面的总长度时 发送请求查询下一页数据
                if ($(document).scrollTop() + $(window).height() >= $(document).height() - 50) {//提前五十像素发送请求
                    //当前页小于总页数的时候才查询
                    if (currentPage <= totalPage) {
                        query();
                    } else {
                        $(document).dialog({
                            type: 'notice',
                            infoIcon: '../img/icon/loading.gif',
                            infoText: '不要拉了,再拉就出屎了!',
                            autoClose: 2500
                        });
                    }

                }
            })
            //发球请求按钮跳转
            $(".submitBtn").click(function () {
                window.location.href = "/mine/editTogether.html"
            })
        });


    </script>
    <style>
        .aa {
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
        }
    </style>
</head>
<body>

<div id="template" style="display: none">
    <div class="col-6 mb">
        <a>
            <img class="float-left">
            <div class="classify-text">
                <span></span>
                <p>0人收藏</p>
            </div>
        </a>
    </div>
</div>

<div class="search-head">
    <div class="row nav-search">
        <div class="col-2">
            <a href="/index.html">
                <span><i class="fa fa-chevron-left fa-2x"></i></span>
            </a>
        </div>
        <div class="col-10">
            <div class="input-group-sm search">
                <input class="form-control searchBtn" placeholder="查找约伴关键字">
            </div>
        </div>
    </div>
</div>

<ul class="nav nav-pills nav-justified border border-left-0 border-top-0 border-right-0" id="pills-tab" role="tablist">

    <li class="nav-item">
        <a class="nav-link active show" data-toggle="pill" href="#pills-top">
            <span align="left">有缘千里来相会</span>
        </a>
    </li>

</ul>

<div class="tab-content" id="pills-tabContent">
    <div class="tab-pane fade active show" id="pills-top">
        <div id="carouselExampleControls" class="carousel slide" data-ride="carousel">

            <div id="togethers">
                <div class="carousel-inner" render-loop="list">
                    <div class="carousel-item">
                        <a render-key="list.id" render-fun="getHref" data-url="productData.html?id=">
                            <img class="d-block w-100" render-src="list.coverUrl" width="100%" height="200px">
                            <span class="recommend" render-html="list.author.nickName" style="color: black"></span><br>
                            <span class="recommend" render-html="list.intro" style="color: #5a6268"></span></a>
                    </div>
                </div>
            </div>

            <a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
                <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                <span class="sr-only"></span>
            </a>
            <a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
                <span class="carousel-control-next-icon" aria-hidden="true"></span>
                <span class="sr-only"></span>
            </a>
        </div>

        <hr>
        <div class="container togethers">
            <h6>全部结伴</h6>
            <div class="row hot" render-loop="list">
                <div class="col-6">
                    <a data-url="/togetherDetail.html?id=" render-fun="getHref" render-key="list.id">
                        <img render-src="list.coverUrl">
                    </a>
                    <div class="col-12 mine">
                        <a data-url="/userProfiles.html?id=" render-fun="getHref" render-key="list.author.id">
                            <img class="rounded-circle" render-src="list.author.headImgUrl" style="width: 10%">
                            <span render-html="list.author.nickName"></span>
                            <span class="addr" render-html="list.place.name"></span>
                        </a>
                    </div>
                    <div class="col-12 mine">
                        <span class="title aa" render-html="list.title" id="title"></span>
                    </div>
                    <div class="d-flex">
                        <div class="p-12  flex-fill">
                            <i class="fa fa-calendar"></i> <span render-html="list.travelTime"></span>
                        </div>
                    </div>
                    <div class="d-flex">
                        <div class="d-flex">
                            <div class="p-6  flex-fill"><i class="fa fa-money"></i>
                                <span render-html="list.perExpends"></span>$
                            </div>
                            <i class="fa fa-user-circle p-1"></i><span render-html="list.persons"></span>
                        </div>
                    </div>
                    <div class="d-flex">
                        <div class="d-flex">
                            <div class="p-12  flex-fill"><i class="fa fa-clock-o"></i>
                                <span render-html="list.days"></span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div>

            </div>
            <div class="wx_nav" id="wx_nav">
                <button type="button" class="btn btn-danger btn-default btn-lg btn-block submitBtn">发起艳遇</button>
            </div>
        </div>
    </div>
</div>

</body>

</html>
